
import time


from selenium import webdriver
from selenium.webdriver.common.by import By

driver=webdriver.Edge()
driver.maximize_window() #浏览器最大化操作


driver.get("http://localhost/index.php/Home/user/login.html")
driver.find_element(By.CSS_SELECTOR,"#username").send_keys("13522221212")
driver.find_element(By.CSS_SELECTOR,"#password").send_keys("123456")
driver.find_element(By.CSS_SELECTOR,"#verify_code").send_keys("8888")
driver.find_element(By.CSS_SELECTOR,"a[name='sbtbutton']").click()
time.sleep(2)

ele_mu_nums=driver.find_elements(By.CSS_SELECTOR,"a>em.mu-num")
# 办法1:
a,b,c,d=ele_mu_nums
dict1={
    "会员折扣":a.text,
    "账户余额":b.text,
    "可用积分":c.text,
    "优惠卷":d.text,
}
# 办法2:
# dict1={
#     "会员折扣":0,
#     "账户余额":0,
#     "可用积分":0,
#     "优惠卷":0,
# }

# for i, item in enumerate(dict1.items()):
#     dict1[item[0]] =ele_mu_nums[i].text
print(dict1)



# 4 关闭浏览器驱动对象
time.sleep(100)  #代码暂停10s中
driver.quit()